<?php 
  require(dirname(__FILE__)."/global.php");
  require(dirname(__FILE__)."/isLogin.php");
  
  $submit = $_POST['submit'];
  if(!isset($submit)){
      
  }   
  else{                        
      $dels = $_POST['dels']; 
      $users = $_POST['users'];
      
      foreach($dels as $del){
          $sql = "update talking_user set UserGroup=UserOldGroup,UserOldGroup=1 where UserID =".$del;
          $db->execute($sql);
      }
      
      for($i = 0;$i < count($users); $i++){
          $sql = "select UserName from talking_user where UserName = '".$users[$i]."'";
          $temp = $db->query($sql);
          if(count($temp) > 0){
              $sql = "update talking_user set UserOldGroup = UserGroup,UserGroup = 1 where UserName = '".$users[$i]."'";
              $db->execute($sql);
          }
      }
  }
  $sql = "SELECT UserID,UserName,UserEmail,UserPostNum,UserRegistTime,UserLastLoginTime FROM talking_user WHERE UserGroup = 1";                                    
  $users = $db->query($sql);
  $smarty->assign('users',$users); 
  $smarty->display("user_filter.html");
  $db->close();                                 
?>
